import Vue from 'vue'
import Router from 'vue-router'
import Index from './views/Index.vue'
import Splash from "./views/Splash"
import Guide from "./views/Guide"
import Home from "./views/Home/Home";
Vue.use(Router)

export default new Router({
  mode: process.env.NODE_ENV === 'development' ? 'hash' : 'history',
  scrollBehavior(to, from, savedPosition) {
    return { x: 0, y: 0 }
  },
  routes: [
    {
      path: "/",
      redirect: "/index"
    },
    {
      path: '/index',
      component: Index,
      children: [{
        path: "",
        redirect: "/index/home"
      }, {
        path: "home",
        component: Home,
      },
      {
        path: "order",
        component: () => import("./views/Order/Order"),
        meta: { needLogin: true }
      },
      {
        path: "openReward",
        component: () => import("./views/Person/OpenReward")
      },
      {
        path: "shoppingCar",
        component: () => import("./views/shoppingCar/shoppingCar"),
        meta: { needLogin: true }
      },
      {
        path: "customerService",
        component: () => import("./views/CustomerService/Service"),
        meta: { needLogin: true }
      },
      {
        path: "person",
        component: () => import("./views/Person/Person"),
      }]
    },
    {
      path: "/orderPay/:order_no",
      name:"orderPay",
      component: () => import("./views/shoppingCar/orderPay"),
      meta: { needLogin: true }
    },
    {
      path: "/discount",
      name:"discount",
      component: () => import("./views/discount/discount"),
    },
    {
      path: "/discountDetail/:id",
      name:"discountDetail",
      component: () => import("./views/discount/discountDetail"),
    },
    {
      path: "/payConfirm",
      name:"payConfirm",
      component: () => import("./views/shoppingCar/payConfirm"),
      meta: { needLogin: true }
    },
    {
      path: "/company-home",
      name: 'company-home',
      component: () => import("./views/company-list/company-home.vue")
    },
    {
      path: "/company-detail/:key",
      name: 'company-detail',
      component: () => import("./views/company-list/company-detail.vue")
    },
    {
      path: "/company_list",
      name: 'companyList',
      component: () => import("./views/company-list/company-list.vue")
    },
    {
      path: "/module/:param",
      name: 'module',
      component: () => import("./views/company-list/module.vue")
    },
    {
      path: "/refundDetail",
      component: () => import("./views/Order/RefundDetail"),
      meta: { needLogin: true }
    },
    {
      path: "/myLuckyNumber/:key",
      name: "myLuckyNumber",
      component: () => import("./views/Person/MyLuckyNumber")
    },
    {
      path: "/downloadApp",
      name: "downloadApp",
      component: () => import("./views/DownloadApp.vue")
    },
    {
      path: "/login",
      name: "login",
      component: () => import("./views/Login")
    },
    {
      path: "/register",
      name: "register",
      component: () => import("./views/Register")
    },
    {
      path: "/recordList/:id/:key/:issue_id",
      name: "recordList",
      component: () => import("./views/Home/RecordList")
    },
    {
      path: "/quickLogin",
      name: "quickLogin",
      component: () => import("./views/QuickLogin")
    },
    {
      path: "/forget",
      name: "forget",
      component: () => import("./views/Forget")
    },
    {
      path: "/shop/:id",
      name: "shop",
      component: () => import("./views/Home/Shop")
    },
    {
      path: "/activities/:id",
      name: "activities",
      component: () => import("./views/Activities")
    },
    {
      path: "/WeChatCallback",
      name: "WeChatCallback",
      component: () => import("./views/WeChatCallback")
    },
    {
      path: "/orderDetail/:id",
      name: "orderDetail",
      component: () => import("./views/Order/OrderDetail")
    },
    {
      path: "/search/:id",
      name: "search",
      component: () => import("./views/Home/Search")
    },
    {
      path: "/capitalDetail",
      name: "capitalDetail",
      component: () => import("./views/Person/CapitalDetail")
    },
    {
      path: "/fundDetail",
      name: "fundDetail",
      component: () => import("./views/Person/FundDetail")
    },
    {
      path: "/splash",
      name: "splash",
      component: Splash
    },
    {
      path: "/guide",
      name: "guide",
      component: Guide
    },
    {
      path: "/setup",
      name: "setup",
      component: () => import("./views/Person/SetUp"),
      meta: { needLogin: true }
    },
    {
      path: "/withdrawal",
      name: "withdrawal",
      component: () => import("./views/Person/CashWithdrawal"),
      meta: { needLogin: true }
    },
    {
      path: "/bankcard",
      name: "bankcard",
      component: () => import("./views/Person/BankCard"),
      meta: { needLogin: true }
    },
    {
      path: "/addbankcard",
      name: "addbankcard",
      component: () => import("./views/Person/AddBankCard"),
      meta: { needLogin: true }
    },
    {
      path: "/addresslists",
      name: "addresslists",
      component: () => import("./views/Person/AddressLists"),
      meta: { needLogin: true }
    },
    {
      path: "/addressadd",
      name: "addressadd",
      component: () => import("./views/Person/AddressAdd"),
      meta: { needLogin: true }
    },
    {
      path: "/addressEdit/:id",
      name: "addressEdit",
      component: () => import("./views/Person/AddressEdit"),
      meta: { needLogin: true }
    },
    {
      path: "/tenants",
      name: "tenants",
      component: () => import("./views/Person/Tenants")
    },
    {
      path: "/focusshop",
      name: "focusshop",
      component: () => import("./views/Person/FocusShop")
    },
    {
      path: "/joindetail/:key",
      name: "joindetail",
      component: () => import("./views/Order/JoinDetail")
    },
    {
      path: "/share",
      name: "share",
      component: () => import("./views/Person/Share")
    },
    {
      path: "/distribution",
      name: "distribution",
      component: () => import("./views/Person/Distribution")
    },
    {
      path: "/distributionDetail/:id",
      name: "distributionDetail",
      component: () => import("./views/Person/DistributionDetail")
    },
    {
      path: "/distributionOrderDetail/:id",
      name: "distributionOrderDetail",
      component: () => import("./views/Person/OrderDetail")
    },
    {
      path: "/fliter",
      name: "fliter",
      component: () => import("./views/Person/Fliter")
    },
    {
      path: "/winList",
      name: "winList",
      component: () => import("./views/Person/WinList")
    },
    {
      path: "/message",
      name: "message",
      component: () => import("./views/Person/Message")
    },
   
    {
      path:"/qcode",
      name:"qcode",
      component:()=>import("./views/Qcode")
    },
    {
      path: "/hotActivity/:id",
      name: "hotActivity",
      component: () => import("./views/Home/HotActivity")
    },
    {
      path: "/myGive",
      name: "myGive",
      component: () => import("./views/Person/myGive")
    },
    {
      path: "/shareReward",
      name: "shareReward",
      component: () => import("./views/Home/shareReward")
    },
    {
      path: "/shareRegister",
      name: "shareRegister",
      component: () => import("./views/ShareRegister")
    },
    {
      path: "/aftersales",
      name: "aftersales",
      component: () => import("./views/Person/AfterSales")
    },
    {
      path: "/evaluation/:id",
      name: "evaluation",
      component: () => import("./views/Order/Evaluation")
    },
    {
      path: "/collection",
      name: "collection",
      component: () => import("./views/Person/Collection")
    },
    {
      path: "/refund/:id",
      name: "refund",
      component: () => import("./views/Order/Refund")
    },
    {
      path: "/previousdetails/:id/:key",
      name: "previousdetails",
      component: () => import("./views/Order/PreviousDetails")
    },
    {
      path: "/deliverDetail/:id",
      name: "deliverDetail",
      component: () => import("./views/Order/DeliverDetail")
    },
    {
      path: "/shareWinOrder/:id/:key/:order_id",
      name: "shareWinOrder",
      component: () => import("./views/Order/ShareWinOrder")
    },
    {
      path: "/info/:url",
      name: "info",
      component: () => import("./views/Order/Info"),
      meta: { needReplace: true }
    },
    {
      path: "/bankEdit/:id",
      name: "bankEdit",
      component: () => import("./views/Person/EditBankCard")
    },
    {
      path: "/teamOrder",
      name: "teamOrder",
      component: () => import("./views/Person/teamOrder")
    },
    {
      path: "/teamOrderDetail/:id",
      name: "teamOrderDetail",
      component: () => import("./views/Person/teamOrderDetail")
    },
    {
      path: "/teamRewardDetail/:id",
      name: "teamRewardDetail",
      component: () => import("./views/Person/TeamRewardDetail")
    },
    {
      path: "/Service",
      name: "service",
      component: () => import("./views/CustomerService/CustomerService"),
      meta: { needLogin: true }
    },
    {
      path: "/recommand/:id",
      name: "recommand",
      component: () => import("./views/Home/Recommand.vue"),
    },
    {
      path: "/detail/:id",
      name: "detail",
      component: () => import("./views/Home/Detail.vue"),
      children:[{
        path: "productDetail/:key/:productId",
        name: "productDetail",
        component: () => import("./views/Home/ProductDetail")
      }]
    },
    {
      path: "/coupon/:id",
      name: "coupon",
      component: () =>import("./views/Home/Coupon")
    },
    {
      path: "/position",
      name: "position",
      component: () =>import("./views/Home/Position")
    }
   
  ]
})
